<!DOCTYPE html>
<html lang="zh-CN">
 <head> 
<#include "../head.html" />
<link href="${base}/res/bootstrap/css/bootstrap-spinner.css" rel="stylesheet">
<script src="${base}/res/bootstrap/js/jquery.spinner.min.js"></script>
<#import "../layout/page.html" as allBase>
 </head> 
 <body>
<#include "../layout/top.html" />
<div class="container bs-docs-container"> 
  <div class="row">
	<#include "../layout/left-menu.html" />
	<div class="col-md-9" role="main">
		<div class="alert alert-info" id="tb_num">
		说明：在这里可以给用户分配角色，解禁/禁用用户
		</div>
		<form id="optionConditionForm" action="${base}/user/icm" method="post">
			<input id="pageNumber" type="hidden" name="pageNumber" value="${page.pageNumber}" />
		</form>	
			<div class="table-responsive">
			<form action="" method="post">
				<table class="table table-hover">
					<thead>
						<tr>
							<th>序号</th>
							<th>用户名</th>
							<th>绑定账号</th>
							<th>角色</th>
							<th>创建时间</th>
							<th>状态</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
					<#assign x=(page.pageNumber-1)*page.pageSize+1>
					<#list page.list as bean>
						<tr>
						<td>
							${x}
						</td>
						<td class="wrap">${bean.userName}</td>
						<td>
							${bean.bcount}
						</td>
						<td>
							<select onchange="setGroup(this,'${bean.guid}')">
							 <#list groupList as ob>
								<option value="${ob.code}" <#if bean?? && bean.group = ob.code>selected="selected"</#if>>${ob.description}</option>
							 </#list>
							</select>
						</td>
						<td>${bean.createTime}</td>
						<td>
							<#if bean.isDeleted?? && bean.isDeleted>
								<span class="label label-danger">禁用</span>
							<#else>
								<span class="label label-success">正常</span>
							</#if>
						</td>
						<td>
							<a href="${base}/user/cz?guid=${bean.guid}">
							   <#if bean.isDeleted?? && bean.isDeleted>
								解禁
								<#else>
								禁用
								</#if>
							</a>
						</td>
						</tr>
						<#assign x=x+1>
					</#list>
					</tbody>
				</table>
				</form>
			</div>
			<@allBase.pagination/>
	</div>
  </div>
 </div>
 <script type="text/javascript">
 function pagination(pageNumber) {
	$("#pageNumber").val(pageNumber);
	$("#optionConditionForm").submit();
 }
 function setGroup(ob,guid){
	 var index = layer.load(0, {shade: false});
	 $.ajax({
		type : 'POST', 
      	dataType :"text",
        data :  "guid="+guid+"&group="+$(ob).val(),
		url : "${base}/user/setGroup",
		success : function(data){
			var da = eval( "(" + data + ")" );
			if(da.status == 200){//更新成功
				layer.close(index);
			}
		}
	});
 }
 </script>
 </body>
</html>